package com.example.eurekaclientconsumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * </p>
 *
 * @author Zero
 * @since 2019/3/5
 */
@RestController
public class ExampleController {

    @Autowired
    private ExampleService exampleService;

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String hello(@RequestParam(value = "name") String name) {
        try {
            return exampleService.hello(name);
        } catch (Exception e) {
            e.printStackTrace();
            return "接口调用异常：" + e.getMessage();
        }
    }

}
